<script setup lang="ts">
import { inject } from 'vue';
// 接收数据
const money = inject('money');
// 接收函数传参
const pagMoney = inject<(count: number) => void>('pagMoney');
</script>

<template>
  <div class="child-page" style="padding: 50px; border: 10px solid #ccc">
    孙子组件{{ money }}
    <button @click="pagMoney && pagMoney(10)">花钱</button>
  </div>
</template>